//
//  KEAlphabetGame-UI.swift
//  KoalaEn
//
//  Created by Wade on 2024/9/12.
//

import Foundation
import UIKit
extension KEAlphabetGame{
    func setupSubViews(){
        let contentView = UIView()
        self.view.addSubview(contentView)
        contentView.snp.makeConstraints { make in
            make.top.equalTo(self.view.snp.top)
            make.left.right.bottom.equalTo(self.view)
        }
        
        let bgImage = UIImageView()
        bgImage.image = .init(named: "bg_main")
        bgImage.contentMode = .scaleAspectFill
        contentView.addSubview(bgImage)
        bgImage.snp.makeConstraints { make in
            make.edges.equalTo(contentView)
        }
        
        let backBtn = UIButton()
        backBtn.setImage(.init(named: "ic_back"), for: .normal)
        contentView.addSubview(backBtn)
        backBtn.snp.makeConstraints { make in
            make.width.height.equalTo(40)
            make.top.equalTo(contentView.safeAreaLayoutGuide.snp.top)
            make.left.equalTo(contentView).offset(10)
        }
        backBtn.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
        
        
        let gameView = KEGameView()
  
        contentView.addSubview(gameView)
        self.gameView = gameView
        self.gameView?.gameList = self.gameList
        gameView.snp.makeConstraints { make in
            make.top.equalTo(backBtn.snp.bottom).offset(20)
            make.left.right.equalTo(contentView)
            make.height.equalTo(580)
        }
        
       
        
    }
}
